package de.hhbk.feedbackmodul.entities;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;


/**
 * The persistent class for the antwortmoeglichkeit database table.
 * 
 */
@Entity
@Table(name="antwortmoeglichkeit")
public class AnswerPossibility implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	private int id;

	@Column(length=255)
	private String text;

    @ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "frage_antwortmoeglichkeit", joinColumns = { 
			@JoinColumn(name = "fk_antwortmoeglichkeit", nullable = false, updatable = false,unique=true) }, 
			inverseJoinColumns = { @JoinColumn(name = "fk_frage", 
					nullable = false, updatable = false,unique=true) })
    private Set<Question> fragen = new HashSet<Question>();
    
    @ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "antwort_antwortmoeglichkeit", joinColumns = { 
			@JoinColumn(name = "fk_antwortmoeglichkeit", nullable = false, updatable = false,unique=true) }, 
			inverseJoinColumns = { @JoinColumn(name = "fk_antwort", 
					nullable = false, updatable = false,unique=true) })
    private Set<Answer> answers = new HashSet<Answer>();
    
    public AnswerPossibility() {
    }

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getText() {
		return this.text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Set<Question> getFragen() {
		return fragen;
	}

	public void setFragen(Set<Question> fragen) {
		this.fragen = fragen;
	}

	public Set<Answer> getAnswers() {
		return answers;
	}

	public void setAnswers(Set<Answer> answers) {
		this.answers = answers;
	}
	
}